package com.itheima.一对一查询.service;

import com.github.pagehelper.PageHelper;
import com.itheima.一对一查询.domain.Student;
import com.itheima.一对一查询.mapper.StudentMapper;
import com.itheima.一对一查询.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class Test {

    @org.junit.Test
    public void selectAll(){
        //1获取SqlSession对象
        SqlSession sqlSession = MyBatisUtils.getSqlSession();
        //2.获取StudentMapper的接口实现类对象
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        //3.使用mapper调用其方法
        List<Student> list = mapper.selectAll();
        //4.处理结果集
        for (Student stu : list) {
            System.out.println(stu);
        }

    }

}
